<%@include file="top.jsp"%>
<jsp:useBean id="user" type="mvc.User" scope="session" />
<%

String username = user.getUsername();

if(username.equals(""))
	out.println("You have to log in to see this page!<br><a href=\"/mvcjsp/login.jsp\">To Login Page</a>");
else{
	out.println("Logged in as " + username + "<br><a href=\"/servlet/mvc.Servl?state=logout\">Logout</a>");

if(request.getAttribute("errorMessage")!=null)
out.println(request.getAttribute("errorMessage"));%>

<jsp:useBean id="profile" type="mvc.Profile" scope="session" />
<center>
<table width="560" border="0">
	<tr>
      <td><h3>Edit My Profile</h3><hr style="border:dashed #676767; border-width:1px 0 0 0; height:1;"></td>
    </tr>
</table>
<FORM name="editform" method="post" action="/servlet/mvc.Servl?state=edit&edit=up">
<table width="560" border="0">
	<tr>
      <td width="70">Firstname</td>
	  <td><INPUT type="text" name="firstname" size="20" value="<%=profile.getFirstname()%>"></td>
	</tr>
	<tr>
      <td>Lastname</td>
	  <td><INPUT type="text" name="lastname" size="20" value="<%=profile.getLastname()%>"></td>
	</tr>
	<tr>
      <td>Email</td>
	  <td><INPUT type="text" name="email" size="20" value="<%=profile.getEmail()%>"></td>
	</tr>
	<tr>
      <td>Mobile nr.</td>
	  <td><INPUT type="text" name="mobilenr" size="20" value="<%=profile.getMobilenr()%>"></td>
	</tr>
	<tr>
      <td>Website</td>
	  <td><INPUT type="text" name="website" size="20" value="<%=profile.getWebsite()%>"></td>
	</tr>
	<tr>
      <td>Text</td>
	  <td><textarea name="profile_text"><%=profile.getProfiletextEdit()%></textarea></td>
	</tr>
	<tr>
      <td><br><INPUT type="submit" name="upd" value="Update"></FORM></td>
	  <td></td>
	</tr>
</table><br>
<table width="560" border="0">
	<tr>
      <td><h3>Costumize the site</h3><hr style="border:dashed #676767; border-width:1px 0 0 0; height:1;"></td>
    </tr>
</table>
<table width="560" border="0">
<form method="post" action="/servlet/mvc.Servl?state=edit&edit=up2">
	<tr>
      <td width="190">Number of posts on gb-page:</td>
	  <td>
		<select name="nrgb">
		<option value="4">4</option>
		<option value="8">8</option>
		<option value="12">12</option>
		<option value="16">16</option>
		</select>
		</td>
	</tr>
	<tr>
      <td>After logging in i want to see:</td>
	  <td>
	  	<select name="redirect">
		<option value="news">News Page</option>
		<option value="guestbook">GuestBook</option>
		<option value="profile&myprofile">My Profile</option>
		<option value="-">--</option>
		</select><br><br>	
	  </td>
	</tr>
	<tr>
		<td><INPUT type="submit" name="upd" value="Update">
		</form></td>
		<td></td>
		</tr>
			
</table>

<%
}
%>
</center>
<%@include file="bottom.jsp"%>